package RTC_CALL;

public class Example {
    public class Instruction {
    }
    public class JmpInstruction extends Instruction {
        private final Number address;
        protected JmpInstruction(Number address) {
            this.address = address;
        }
        public Number getAddress() {
            return address;
        }
    }
    public class ShortJmpInstruction extends JmpInstruction {
        public ShortJmpInstruction(Byte address) {
            super(address);
        }
    }
    // ...
    public void visitInstruction(JmpInstruction i) {
        if (i instanceof ShortJmpInstruction) {
            // cast is not necessary here
            Number address =
                    ((ShortJmpInstruction) i).getAddress();
            print(address);
        }
        // then visit other instrucrions..
    }
}
